namespace Domotica.Windows.Input
{
    using Microsoft.VisualBasic;
    using System;
    using System.Windows;
    using System.Windows.Input;

    public class SignEventArgs : InputEventArgs
    {
        private Rect _Bounds;
        private Domotica.Windows.Input.SignAction _SignAction;
        private StylusPointCollection _StylusPoints;

        public SignEventArgs(InputDevice inputDevice, int timestamp, Domotica.Windows.Input.SignAction signAction, StylusPointCollection stylusPoints) : base(inputDevice, timestamp)
        {
            this._SignAction = signAction;
            this._StylusPoints = stylusPoints;
        }

        public Rect Bounds
        {
            get
            {
                if (this._Bounds == Rect.Empty)
                {
                    int top = 0x7fffffff;
                    int bottom = -2147483648;
                    int left = 0x7fffffff;
                    int right = -2147483648;
                    foreach (StylusPoint p in this.StylusPoints)
                    {
                        if (p.Y < top)
                        {
                            top = (int) Math.Round(p.Y);
                        }
                        if (p.X < left)
                        {
                            left = (int) Math.Round(p.X);
                        }
                        if (p.Y > bottom)
                        {
                            bottom = (int) Math.Round(p.Y);
                        }
                        if (p.X > right)
                        {
                            right = (int) Math.Round(p.X);
                        }
                    }
                    this._Bounds = new Rect((double) left, (double) top, (double) (right - left), (double) (bottom - top));
                }
                return this._Bounds;
            }
        }

        public Domotica.Windows.Input.SignAction SignAction
        {
            get
            {
                return this._SignAction;
            }
        }

        public StylusPointCollection StylusPoints
        {
            get
            {
                return this._StylusPoints;
            }
        }
    }
}

